let ajaxTimes = 0;
export const request = (params) => {
  //定义公共的接口：
  ajaxTimes++;
  wx.showLoading({
    title: '加载中',
    mask: true
  });
  const baseUrl = "https://centos.dusin.top:8443/WorkListServer/servlet";
  // const baseUrl = "http://localhost:8084/WorkListServer/servlet";
  return new Promise((resolve, reject) => {
    wx.request({
      ...params,
      url: baseUrl + params.url,
      header: { 
        'content-type': 'application/x-www-form-urlencoded'  
      },
      success: (result) => {
        resolve(result);
      },
      fail: (err) => {
        reject(err);
      },
      complete: () => {
        ajaxTimes--
        if (ajaxTimes == 0) {
          wx.hideLoading();
        }
      }
    });

  })
}